//
//  DeviceUtil.m
//  Finder
//
//  Created by cdm on 11-3-29.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "DeviceUtil.h"


@implementation DeviceUtil

+ (DeviceType)getDeviceType
{
    NSString *modal = [UIDevice currentDevice].model;
    if ([modal isEqualToString:@"iPhone"]) {
        return DeviceTypePhone;
    } else {
        return DeviceTypePod;
    }
}

+ (BOOL)canSendMail
{
    Class messageClass = (NSClassFromString(@"MFMessageComposeViewController"));
	
	if (messageClass != nil) { 			
		// Check whether the current device is configured for sending SMS messages
		if ([messageClass canSendText]) {
			return YES;
		}
		else {	
            return NO;
        }
	} else {
		return NO;
	}
}

+ (BOOL)canSendSMS
{
    Class messageClass = (NSClassFromString(@"MFMessageComposeViewController"));
	
	if (messageClass != nil) { 			
		// Check whether the current device is configured for sending SMS messages
		if ([messageClass canSendText]) {
			return YES;
		} else {	
			return NO;
		}
	} else {
		return NO;
	}
}

+ (BOOL)canCallPhone
{
    DeviceType deviceType = [self getDeviceType];
    if (deviceType == DeviceTypePhone) {
        return YES;
    } else {
        return NO;
    }
}

@end
